package com.ctshk.rpc.tour.entity.es;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.ctshk.common.constant.ElasticSearchConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;

/**
 * @author lys
 */
@Data
@Accessors(chain = true)
@ApiModel(value="TripCache对象", description="行程列表对象")
@Document(indexName = ElasticSearchConstant.TRIP_INDEX)
public class TripCache implements Serializable {

    @ApiModelProperty(value = "id")
    @Field(type = FieldType.Long)
    private Long id;

    @ApiModelProperty(value = "行程id")
    @Field(type = FieldType.Long)
    private Long tripId;

    @ApiModelProperty(value = "渠道id")
    @Field(type = FieldType.Long)
    private Long channelId;

    @ApiModelProperty(value = "行程标题")
    private String title;

    @ApiModelProperty(value = "副标题")
    private String subtitle;

    @ApiModelProperty(value = "行程特色JSON")
    private List<String> tripFeaturesJson;

    @ApiModelProperty(value = "目的地主数据ID(三级分类)")
    @Field(type = FieldType.Long)
    private Long destinationId;

    @ApiModelProperty(value = "目的地")
    @Field(type = FieldType.Keyword)
    private String destination;

    @ApiModelProperty(value = "出发地主数据ID")
    @Field(type = FieldType.Long)
    private Long departurePlaceId;

    @ApiModelProperty(value = "出发地")
    @Field(type = FieldType.Keyword)
    private String departurePlace;

    @ApiModelProperty(value = "旅游组别主数据ID(一级分类)")
    @Field(type = FieldType.Long)
    private Long tourTypeId;

    @ApiModelProperty(value = "旅游组别主数据Code(一级分类)")
    @Field(type = FieldType.Keyword)
    private String tourTypeCode;

    @ApiModelProperty(value = "旅游组别名称")
    @Field(type = FieldType.Keyword)
    private String tourTypeName;

    @ApiModelProperty(value = "旅行团性质")
    @Field(type = FieldType.Keyword)
    private Long groupNatureId;

    @TableField(typeHandler = FastjsonTypeHandler.class)
    @ApiModelProperty(value = "旅行团主题JSON")
    @Field(type = FieldType.Nested)
    private List<TourThemeJsonCache> tourThemeJson;

    @ApiModelProperty(value = "行程出发日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Field(type = FieldType.Date,format = DateFormat.date)
    private List<LocalDate> departureDate;

    @ApiModelProperty(value = "出行天数")
    @Field(type = FieldType.Long)
    private Integer travelDays;

    @ApiModelProperty(value = "封面图")
    @Field(index = false)
    private String coverPhotoUrl;

    @ApiModelProperty(value = "默认展示价格")
    @Field(type = FieldType.Nested)
    private List<TripBasePrice> basePrice;

    @ApiModelProperty(value = "销量")
    @Field(type = FieldType.Long)
    private Integer saleCount;

    @ApiModelProperty(value = "是否当季热卖")
    @Field(type = FieldType.Long)
    private Integer isHot;

    @ApiModelProperty(value = "最近30天是否成团,0：已成团")
    @Field(type = FieldType.Long)
    private Integer isTeam;

    @ApiModelProperty(value = "最近30天是否可预定,0：可预定，1：不可预定")
    @Field(type = FieldType.Long)
    private Integer isReserve;

    @ApiModelProperty(value = "创建时间")
    @Field(type = FieldType.Date,format = DateFormat.date)
    private LocalDate gmtCreate;

    @ApiModelProperty(value = "景点列表")
    @Field(type = FieldType.Nested)
    private List<ScenicJsonCache> scenicJson;

    @ApiModelProperty(value = "团期列表")
    @Field(type = FieldType.Nested)
    private List<SeriesTripScheduleCache> schedules;

    @ApiModelProperty(value = "业务类型：1:出境游 2:入境游")
    private Integer businessType;

}
